Skip to content

Adding Instructor-Based Response Model Feature to Model Adapters#52

Draft
cemde wants to merge 5 commits intomainfrom
feature/response-model
Draft

Adding Instructor-Based Response Model Feature to Model Adapters#52
cemde wants to merge 5 commits intomainfrom
feature/response-model

Conversation

@cemde
Copy link
Collaborator

@cemde cemde commented Mar 24, 2026

Description

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code quality improvement (refactoring, formatting, etc.)

Checklist

Contribution

Documentation

  • Added/updated docstrings for new/modified functions as instructed CONTRIBUTING.md
  • Updated relevant documentation in docs/ (if applicable)
  • Tag github issue with this PR (if applicable)

Changelog

  • Added entry to CHANGELOG.md under [Unreleased] section
    • Use Added section for new features
    • Use Changed section for modifications to existing functionality
    • Use Fixed section for bug fixes
    • Use Removed section for deprecated/removed features
  • OR this is a documentation-only change (no changelog needed)

Example:
- Support for multi-agent tracing (PR:#123)

Architecture (if applicable)

  • Core/Interface separation: Changes in maseval/core/ do NOT import from maseval/interface/
  • Dependencies: New core dependencies added sparingly; framework integrations go to optional dependencies

Additional Notes

cemde added 5 commits March 22, 2026 22:55
Integrate the instructor library to provide validated structured outputs
from LLM calls. ModelAdapter.chat() now accepts a response_model parameter
(any Pydantic BaseModel), with _structured_chat() implemented across all
four provider adapters (OpenAI, Anthropic, Google GenAI, LiteLLM).

Simplifies simulators by replacing ~150 lines of manual JSON extraction
and retry logic with instructor's automatic validation and retries.
Adds maseval.core.instructor module with helpers for creating
instructor-patched clients and flattening Pydantic schemas.

PR: #49
* bugfix enables passing generation parameters to model adapter for google genai.
* fixed bug in model adapter
* added test
@github-actions
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  maseval
  __init__.py
  maseval/benchmark/tau2
  tau2.py
  maseval/benchmark/tau2/domains
  base.py
  maseval/core
  instructor.py 89
  model.py
  simulator.py 224
  maseval/interface/inference
  anthropic.py 388-390
  google_genai.py
  litellm.py 220-221
  openai.py 304-306
Project Total  

This report was generated by python-coverage-comment-action

@cemde
Copy link
Collaborator Author

cemde commented Mar 24, 2026

waiting for 567-labs/instructor#2210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant